
;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
triggerall = !MatchOver
trigger1 = !Time
value = 181

[State 180, 2]
type = ChangeState
triggerall = MatchOver
trigger1 = !Time
value = 182

;---------------------------------------------------------------------------
;Round Win
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0

[State 181, 1]
type = Null
trigger1 = AnimElem = 6
value = F0,1
;---------------------------------------------------------------------------
;Match Win
[Statedef 182]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181, 1]
type = Null
trigger1 = AnimElem = 6
value = F0,1 

;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, 1]
type = VarSet
trigger1 = NumPartner && (ID = 57 || ID = 59)
trigger2 = !AILevel
trigger3 = AILevel && enemy,Name = "Bonus"
var(5) = 1

[State 190, 2]
type = VarSet
trigger1 = !Time && !NumPartner && (!AILevel || AILevel && enemy,Name = "Bonus")
var(32) = 181

[State 190, 3] ;Go straight to intro.
type = ChangeState
trigger1 = !Time
value = 191
;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
anim = 1
physics = N
sprpriority = -3

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0

[State 5150, 2] ;Friction
type = LifeSet
trigger1 = !Time && !Var(5) && RoundNo < 5
trigger2 = Var(5)
trigger3 = !Time && !Var(5) && RoundNo >= 5
value = 0

[State 0, Helper]
type = Null ;Not applicable for this Bonus
trigger1 = !Time && RoundNo >= 5 && !Var(0) && !Var(5)
name = "Survival Kill"
ID = 60
stateno = 60
pos = 0,0
postype = p2
facing = 1
ownpal = 1

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = U
physics = U

[State 40, 1]
type = ChangeState
trigger1 = 1
value = 0
;---------------------------------------------------------------------------
; LOSE (Time over)
[Statedef 170]
type = S
ctrl = 0
anim = 1
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
; DRAWGAME (Time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 1

[State 175, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
;F1'd
[Statedef 5050]
type = A
physics = N
anim = 4
sprpriority = 0
ctrl = 0

[State 5, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 5, 2]
type = ChangeState
trigger1 = !Time
value = 5150


;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 3]
type = VarSet
trigger1 = RoundNo > 1
var(6) = var(31)

;[State 5900, 4]
;type = VarSet
;trigger1 = roundsexisted = 0
;var(7) = 0

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 0
last = 30

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 32

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 3]
type = VarSet
trigger1 = RoundNo > 1
var(6) = var(31)

[State 5900, 1] ;Change palette
type = RemapPal
trigger1 = 1
source = 1,1
dest = 1,palno

[State 5900, 2] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190
ctrl = 0

[State 5900, 5]
type = Null
trigger1 = RoundNo = 1
var(32) = 181

[State 5900, 6] ;All other rounds
type = ChangeState
trigger1 = 1
value = 0
ctrl = 0